import React,{Component} from "react";


class DemoSetStateAttr extends Component{
    state={
        userinfo: {
            role:'admin',
            age: 18,
            email: '123@163.com' // 修改邮箱
          }
    }

    render(){
        return(<>
            <h3>修改state对象下面的某个属性</h3>
            <p>邮箱:{this.state.userinfo.email}</p>
            <button onClick={()=>this.changeUserInfo('欢迎来到小小小@666.com')}>修改邮箱地址</button>
        </>)
    }
}

export default DemoSetStateAttr